package com.team06.login.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team06.login.entity.UserRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {

    // 批量插入方法（使用注解方式）
    @Insert("<script>" +
            "INSERT INTO \"airport6\".USER_ROLES (USER_ID, ROLE_ID) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.userId}, #{item.roleId})" +
            "</foreach>" +
            "</script>")
    int insertBatch(@Param("list") List<UserRole> userRoles);
}